<?php
//+---------------------------------------------------------------------------------------------------------------------
//| 人生是荒芜的旅行，冷暖自知，苦乐在心
//+---------------------------------------------------------------------------------------------------------------------
//| Author:Janmas <janmas@126.com>
//+---------------------------------------------------------------------------------------------------------------------
//| 
//+---------------------------------------------------------------------------------------------------------------------


namespace app\common\event;


use app\admin\model\User;
use think\facade\Db;

/**
 * 订阅管理员登入登出
 * @package app\common\event
 */
class UserSubscribe
{
	public function onUserLogin( User $user )
	{
		$user->where('id', session('SYSTEM_ID'))->update(
			[
				'login_cnt' => Db::raw('login_cnt+1'),
				'last_login_time' => time(),
				'last_login_ip' => request()->ip()
			]
		);

		return true;

	}

	public function onUserLogout( $user )
	{
		// UserLogout事件响应处理
	}
}